package hdoj;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

//奇怪的电梯，每一层能到达i +/- Di
public class BFSHDU1548 {

	private static final int MAX = 200;
	private static final int[] dir = {1, -1};
	
	private int rows;
	
	private int startX;
	
	private int endX;
	
	private int minLength = -1;
	
	private int[] di = new int[MAX];
	private boolean[] visited = new boolean[MAX];
	
	public static void main(String[] args) {
		BFSHDU1548 object = new BFSHDU1548();
		object.getRes();
	}
	
	public void getRes(){
		Scanner scanner = new Scanner(System.in);
		while(scanner.hasNext()){
			minLength = -1;
			rows = scanner.nextInt();
			if(rows == 0){
				break;
			}
			startX = scanner.nextInt();
			endX = scanner.nextInt();
			startX--;
			endX--;
			for(int i = 0; i < rows; i++){
				di[i] = scanner.nextInt();
			}
			bfs();
			System.out.println(minLength);
		}
		scanner.close();
	}
	
	private class Node{
		int x;
		int step;
		public Node(int x){
			this.x = x;
		}
	}
	
	//Runtime: 421MS
	public void bfs(){
		Queue<Node> queue = new LinkedList<>();
		Node temp = new Node(startX);
		queue.add(temp);
		Arrays.fill(visited, false);
		visited[startX] = true;
		while(!queue.isEmpty()){
			temp = queue.poll();
			if(temp.x == endX){
				minLength = temp.step;
				return;
			}
			for(int i = 0; i < dir.length; i++){
				int curX = temp.x + dir[i] * di[temp.x];
				if(curX < 0 || curX >= rows || visited[curX]){
					continue;
				}
				Node next = new Node(curX);
				next.step = temp.step + 1;
				visited[curX] = true;
				queue.add(next);
			}
		}
	}
}
